package com.itheima.controller.oms;

import com.itheima.core.PageInfo;
import com.itheima.core.R;
import com.itheima.pojo.oms.OmsOrderReturnApply;
import com.itheima.pojo.oms.PageInfoList;
import com.itheima.pojo.oms.statusParam;
import com.itheima.pojo.oms.vo.IdsVo;
import com.itheima.service.oms.OmsOrderReturnApplyService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;


import java.util.List;

@RestController
@RequestMapping("/returnApply")
public class OmsOrderReturnApplyController {
    @DubboReference
    private OmsOrderReturnApplyService omsOrderReturnApplyService;

    /*批量删除退货申请*/
    @PostMapping("/delete")
    public R delete(  @RequestParam List<Integer> ids){
        omsOrderReturnApplyService.removeByIds(ids);
        return R.success();
    }
    /*分页查询退货申请*/
    @GetMapping("/list")
    public R listAll(@RequestParam int  pageNum, @RequestParam int  pageSize,String createTime,String handleMan,
                     String handleTime,Integer id,String receiverKeyword,Integer status){
        PageInfo info = omsOrderReturnApplyService.listAll(pageNum,pageSize,createTime,handleTime,handleMan,id,receiverKeyword,status);
        return  R.success("",info);
    }
    /*修改退货申请状态*/
    @PostMapping("/update/status/{id}")
    public R updatestatus(@PathVariable int id,@RequestBody statusParam statusParam1){
            omsOrderReturnApplyService.updatestatus( id,statusParam1);
            return R.success();
    }
    /*获取退货申请详情*/
    @GetMapping("{id}")
    public R getall(@PathVariable int id){
        OmsOrderReturnApply byId = omsOrderReturnApplyService.getById(id);
        return R.success("",byId);
    }
}
